<%@page import="com.exam.dao.QuestionDbDao"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<jsp:include page="checkAdmin.jsp" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
   <link href="css/style.css" rel="stylesheet" type="text/css" />
   <link href="css/select.css" rel="stylesheet" type="text/css" />
   <script type="text/javascript" src="js/jquery-2.0.js"></script>
   <script type="text/javascript" src="js/select-ui.min.js"></script>
   
 <script type="text/javascript">
$(document).ready(function(e) {
    $(".select1").uedSelect({
		width : 345			  
	});
	$(".select2").uedSelect({
		width : 167  
	});
	$(".select3").uedSelect({
		width : 100
	});
	
	var salisa = $("input[name=answer]");
	for(var i=0 ;i<salisa.length;i++){
	//alert(salisa[i].value);
		if(salisa[i].value==$("#rightAnswer").html()){
			salisa.get(i).checked=true;
			//alert(salisa[i].value);
			return false;
		}
	}
});
</script>
   
</head>

<body>
	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">首页</a></li>
    <li><a href="#">管理试题</a></li>
    <li><a href="question-list.action">试题列表</a></li>
    <li><a href="#">修改试题 【 ${fn:substring(content,0,40) } 】</a></li>
    </ul>
    </div>
    
    <div class="formbody">
    <div class="formtitle"><span>修改试题( * 选中项为正确答案)</span></div>
   <form action="question-update.action" method="post">
   	<input type="hidden" name="id" value="${id}"/>
   	<span id="rightAnswer" style="display:none">${answer }</span>
    <ul class="forminfo">
  	 <li><label>所在题库<b> *</b></label>
   		<%
   			//获取题库列表
   			QuestionDbDao qd = new QuestionDbDao();
   			request.setAttribute("DBList", qd.getDBList());
   		 %>
   		 <s:property value="#request.QuestionForm.dbid"/>
   		 <div class="vocation">
	    <select class="select1" name="dbid">
	    	<s:iterator value="#request.DBList" status="gb">
	    			<s:if test="dbid==id">
	    			<option value="<s:property value="id"/>" selected="selected"><s:property value="db_name"/></option>
	    			</s:if>
	    			<s:else>
	    			<option value="<s:property value="id"/>"><s:property value="db_name"/></option>
	    			</s:else>
	    	</s:iterator>
		    
	    </select>	
    	</div>
  	 </li>
    <li><label>题干内容<b> *</b></label>
    <textarea name="content" cols="" rows="" class="textinput">${content }</textarea>
    <i style="color:red">${fieldErrors.content[0] }</i></li>
    <li><label>　选项 A<b>*</b> <input type="radio" name="answer" value="A" ></label><input name="option" type="text" class="dfinput" value="${option[0] }"/></li>
    <li><label>　选项 B<b>*</b> <input type="radio" name="answer" value="B"></label><input name="option" type="text" class="dfinput" value="${option[1] }"/></li>
    <li><label>　选项 C<b>*</b> <input type="radio" name="answer" value="C"></label><input name="option" type="text" class="dfinput" value="${option[2] }"/></li>
    <li><label>　选项 D<b>*</b> <input type="radio" name="answer" value="D"></label><input name="option" type="text" class="dfinput" value="${option[3] }"/></li>
    
    
    <li><label>答案解析</label><textarea name="answer_info" cols="" rows="" class="textinput">${answer_info }</textarea></li>
   
    <li><label>是否启用</label><cite><input name="status" type="radio" value="1" checked="checked" />是&nbsp;&nbsp;&nbsp;&nbsp;<input name="status" type="radio" value="0" />否</cite></li>
    
    <li><label>&nbsp;</label><input name="" type="submit" class="btn" value="确认保存"/></li>
   
    </ul>
    
    </form>
    </div>
</body>
</html>
